import request from "@/service/request.ts";
import requestAly from "@/service/requestAly.ts";

/**
 * 获取凭证
 * @param query
 */
const getOssAuth = (query: any) => {
    return request({
        url: "/system/oss/uploadAuth",
        method: "get",
        params: query
    });
};

/**
 * 文件上传到OSS
 * @param File
 */
const postToOSS = (File: any) => {
    return requestAly({
        url: ``,
        method: "post",
        data: File,
    });
};

/**
 * 绑定封面
 * @param query
 */
const linkCover = (query: any) => {
    return request({
        url: `/course/course/cover?courseId=${query.courseId}&type=${query.type}&url=${query.url}`,
        method: "put",
    });
}

export {
    getOssAuth,
    postToOSS,
    linkCover,
};
